import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Store } from '@ngxs/store';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalService } from 'ng-zorro-antd/modal';
import { EntityListStateService } from '../../core/entity-list.state.service';
import { IdentityUserDto } from '../proxy/identity';
import { IdentityUserDetailService } from '../user-detail/user-detail.service';
import { IdentityUserListState } from './user-list.states';

@Injectable({
  providedIn: 'root',
})
export class IdentityUserListService extends EntityListStateService<IdentityUserDto> {
  public navigateToDetail(): Promise<boolean> {
    return this.router.navigate(['identity/user-detail']);
  }
  public changeToView(id: string): Promise<IdentityUserDto> {
    return this.identityUserDetailService.changeToView(id);
  }
  public changeToEmpty(): Promise<void> {
    return this.identityUserDetailService.changeToEmpty();
  }
  constructor(
    protected store: Store,
    protected modal: NzModalService,
    protected message: NzMessageService,
    protected router: Router,
    private identityUserDetailService: IdentityUserDetailService
  ) {
    super(IdentityUserListState, store, modal, message);
  }
}
